﻿using System.Collections.Generic;

namespace Borg.Framework
{
    internal class ReplacePlugStartup : SlotStartup<ReplaceSlotAttribute>
    {
        private static readonly Dictionary<SlotInfo, ReplacePlug> Data =
            new Dictionary<SlotInfo, ReplacePlug>();

        public override void Register(ExtensionTypeInfo extType)
        { }

        public override void SlotCreated(SlotInfo slot, ReplaceSlotAttribute attr)
        {
            if (attr.Plug)
                Data[slot] = new ReplacePlug(slot, attr.Global);
        }

        public override void SlotReleased(SlotInfo slot, ReplaceSlotAttribute attr)
        {
            if (attr.Plug)
                Data.Remove(slot);
        }

        public override void Unregister(ExtensionTypeInfo extType)
        { }
    }
}

